package com.bulls.demo.hrmsdemo.helper;

import java.math.BigDecimal;
import java.util.Date;

import com.bulls.demo.hrmsdemo.db.Employee;
import com.bulls.demo.hrmsdemo.form.EmployeeForm;
import com.bulls.demo.hrmsdemo.utils.Utilities;
import com.bulls.demo.hrmsdemo.vo.EmployeeVO;

public class EmployeeHelper {

	public static void toDomainObject(EmployeeForm form, EmployeeVO employeeVO) {
		Employee employee  = new Employee();
		employee.setEmployeeid(Utilities.isNull(form.getEmployeeid())?null:Long.valueOf(form.getEmployeeid()));
		employee.setEmployeeName(form.getEmployeeName());
		employee.setDesignation(form.getDesignation());
		employee.setDepartment(form.getDepartment());
		employee.setEmailid(form.getEmailid());
		employee.setMobile(form.getMobile());
		employee.setLastName(form.getLastName());
		employee.setFatherOrHusbandName(form.getFatherOrHusbandName());
		employee.setGender(form.getGender());
		employee.setDateOfBirth(Utilities.isNull(form.getDateOfBirth())?null:Utilities.convertStringtoDate(form.getDateOfBirth()));
		employee.setDateOfJoining(Utilities.isNull(form.getDateOfJoining())?null:Utilities.convertStringtoDate(form.getDateOfJoining()));
		employee.setNatureOfJob(form.getNatureOfJob());
		employee.setPanNumber(form.getPanNumber());
		employee.setProject(form.getProject());
		employee.setReportingto(form.getReportingto());
		employee.setRole(form.getRole());
		employee.setAddress1(form.getAddress1());
		employee.setAddress2(form.getAddress2());
		employee.setCountry(form.getCountry());
		employee.setState(form.getState());
		employee.setCity(form.getCity());
		employee.setPincode(form.getPincode()!=null?new BigDecimal(form.getPincode()):null);
		employee.setTelephoneNumber(form.getTelephoneNumber());
		employeeVO.setEmployee(employee);
	}

}
